package com.qkl.user.dto;

import com.qkl.user.annotation.EqualFields;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import net.sf.jsqlparser.statement.select.First;

@Data
// 自定义注解：检查 password 和 passwordTo 是否相等
@EqualFields(
        first = "password",        // 第一个字段名
        second = "passwordTo",     // 第二个字段名
        message = "两次输入的密码不一致"  // 自定义错误提示
)
public class RegisterRequest {
    @NotBlank(message = "用户名不能为空")
    @Size(min = 3, max = 10, message = "用户名长度必须在3-10之间")
    private String username;
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, message = "密码长度不能少于6位")
    private String password;
    @NotBlank(message = "再次密码不能为空")
    @Size(min = 6, message = "密码长度不能少于6位")
    private String passwordTo;

    @NotBlank(message = "交易密码不能为空")
    @Size(min = 6, message = "交易密码长度不能少于6位")
    private String tradPassword;

    @NotBlank(message = "再次交易密码不能为空")
    @Size(min = 6, message = "再次交易密码长度不能少于6位")
    private String tradPasswordTo;

    @NotNull(message = "问题1不能为空")
    private Integer questionOne;
    @NotBlank(message = "答案1不能为空")
    private String answerOne;

    @NotNull(message = "问题2不能为空")
    private Integer questionTwo;
    @NotBlank(message = "答案2不能为空")
    private String answerTwo;

    @NotBlank(message = "邀请不能为空")
    private String inviteCode;
    @NotBlank(message = "验证码不能为空")
    private String captcha;
    @NotBlank(message = "验证码密钥不能为空")
    private String captchaKey;
}
